<#include "layout.ftl">
<#macro head>
<title>后台管理</title>
<style type="text/css">

</style>
</#macro>

<#macro body>
<div class="container-fluid">
	<div class="row-fluid sortable">		
		<div class="box span12">
			<div class="box-header well" data-original-title>
				<h2><i class="icon-user"></i>作品管理</h2>
			<div class="box-icon">
					<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
					<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
					<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
				</div>
			</div>
			<div class="box-content">
				<a href="addProject.html" class="btn btn-info" style="margin-bottom:20px;">新增作品</a>
				<table class="table table-striped table-bordered bootstrap-datatable datatable">
				  <thead>
					  <tr>
						  <th>ID</th>
						  <th>标题</th>
						  <th>日期</th>
						  <th>操作</th>
					  </tr>
				  </thead>   
				  <tbody>
					<#list projects as project>
					<tr>
						<td>${project.id}</td>
						<td class="center">
							<#if project.title?length gt 50>
								${project.title?substring(0,50)}<span>...</span>
							<#else>
								${project.title}
							</#if>
						</td>
						<td class="center">${project.publishDate}</td>
						<td class="center">
							<a class="btn btn-success" href="${base.contextPath}/project/${project.id}" target="view_window">
								<i class="icon-zoom-in icon-white"></i>  
								查看
							</a>
							<a class="btn btn-info" href="editProject.html?id=${project.id}">
								<i class="icon-edit icon-white"></i>  
								编辑 
							</a>
							<a class="btn btn-primary" href="javascript:del('${project.id}')">
								<i class="icon-trash icon-white"></i> 
								删除
							</a>
						</td>
					</tr>
					</#list>
				  </tbody>
			  </table>
			</div>
		</div><!--/span-->
	
	</div><!--/row-->
</div><!--/.fluid-container-->

</#macro>
<#macro script>
<script type="text/javascript">
function del(id){
	var r = confirm("确定要删除吗？");
	if(r){
	$.ajax({  
            url: "${base.contextPath}/system/delProject.ajax",  
            type: "GET",  
            dataType: "json",
            data: "id=" + id,
            success: function(obj){
            	alert(obj.msg);
            	location.reload();
            },
            error: function(msg){
            	alert("发生异常"); 
            }
        });
    }
}
</script>
</#macro>